package org.example.map;

import org.example.innerclass.A;

import java.util.*;

public class Poker {
    private static Map<Integer,String> poker= new HashMap<>();
    static{
        String[] color = "黑桃-梅花-红桃-方片".split("-");
        String[] number = "3-4-5-6-7-8-9-10-J-Q-K-A-2".split("-");
        int i=0;
        for(String n:number){
            for(String c:color){
                poker.put(i,c+":"+n);
                i++;
            }
        }
        poker.put(52,"小王");
        poker.put(53,"大王");
    }
    public static void main(String[] args) {

        List<Integer> list = new ArrayList<>();
        for(int j=0;j<poker.size();j++){
            list.add(j);
        }

        Collections.shuffle(list);
        List<Integer> p1 = new ArrayList<>();
        List<Integer> p2 = new ArrayList<>();
        List<Integer> p3 = new ArrayList<>();
        List<Integer> dipai = new ArrayList<>();
        for(int j=0;j<list.size()-3;j++){
            if(j%3==0){
                p1.add(list.get(j));
            }else if(j%3==1){
                p2.add(list.get(j));
            }else if(j%3==2){
                p3.add(list.get(j));
            }
        }
        dipai.addAll(list.subList(51,54));
        Collections.sort(p1);
        Collections.sort(p2);
        Collections.sort(p3);
        Collections.sort(dipai);
        showPoker("玩家1",p1);
        showPoker("玩家2",p2);
        showPoker("玩家3",p3);
        showPoker("底牌",dipai);
    }

    private static void showPoker(String name,List<Integer> p1) {
        System.out.println(name+"的牌：");
        for(Integer p:p1){
            System.out.print(poker.get(p)+";");
        }
        System.out.println();
    }
}
